<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<script src="/style/public/publicStyle.js"></script>
	</head>
	<body>
<!--表格-->
<div class="weadmin-body">
	 <!--<input type="text" placeholder="请输入关键字进行搜索" autocomplete="off" class="layui-input eleTree-search">-->
	 <div class="eleTree ele3" lay-filter="data3"></div>
</div>
	</body > 
<script>
layui.use(['jquery','table','tree','code','form','element'], function() {
	var laydate = layui.laydate //日期
			,$ = layui.jquery //分页
			,eleTree = layui.tree //弹层
			,table = layui.table //表格
			,element = layui.element //元素操作
			,form = layui.form;
	var  uid=getCookieVal('Tree_User_Id');
	var logintoken=  getSharreTieba_LoginToken();
	var el3;
	$.ajax({
		url: "/auth/sysUseTag/findByUseId?useId="+uid,
		type: 'get',
		success: function(data) {

			el3 = eleTree.render({
				elem: '.ele3',
				data: data.data,
				showCheckbox: true,
				oncheck: function(obj) {
					var checked = obj.checked;
					if(checked) { //选中新增
						$.ajax({
							url:'/auth/sysUseTag/insert',
							type:'post',
							dataType:'json',
							contentType:'application/json;charset=UTF-8',
							data:JSON.stringify({"useId":uid,"tagId":obj.data.data.id}),
						});
					} else { //取消选中删除

						$.ajax({
							url: "/auth/sysUseTag/delete?tagId="+obj.data.data.id+"&useId="+obj.data.data.use_id,
							type: 'get'
						});
					}

				}
			});
		}
	});
});
</script>
</html>
